<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>

<script type="text/javascript">

  function fun(n, o) {
    console.log(o)
    return {
      fun: function (m) {
        return fun(m, n)
      }
    }
  }


  /*
    var a = fun(0)
    var c = a.fun(1)
    c.fun(2)
    c.fun(3)
  */

  var c = fun(0).fun(1)
  c.fun(2)
  c.fun(3)




  //a.fun 接收到一个闭包 {n:0}
  //var a = fun(0) // undefined
  //b.fun 接收到一个闭包 {n:1}
  // var b = a.fun(1)//0
  // var c = a.fun(2)//0
  // var d = a.fun(3)//0





</script>
</body>
</html>